home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / doors / amixpr / xproto.h < prev   
Encoding:
C/C++ Source or Header  |  1992-12-26  |  7.8 KB  |  210 lines

  1. /** xproto.h
  2. *
  3. *   Include file for External Protocol Handling
  4. *
  5. **/
  6. /*
  7. *   The structure
  8. */
  9. struct XPR_IO {
  10.                   UBYTE  *xpr_filename;      /* File name(s)             */
  11.                   long (*xpr_fopen)();      /* Open file                */
  12.                   long (*xpr_fclose)();     /* Close file               */
  13.                   long (*xpr_fread)();      /* Get UBYTE from file       */
  14.                   long (*xpr_fwrite)();     /* Put string to file       */
  15.                   long (*xpr_sread)();      /* Get UBYTE from serial     */
  16.                   long (*xpr_swrite)();     /* Put string to serial     */
  17.                   long (*xpr_sflush)();     /* Flush serial input buffer*/
  18.                   long (*xpr_update)();     /* Print stuff              */
  19.                   long (*xpr_chkabort)();   /* Check for abort          */
  20.                   long (*xpr_chkmisc)();    /* Check misc. stuff        */
  21.                   long (*xpr_gets)();       /* Get string interactively */
  22.                   long (*xpr_setserial)();  /* Set and Get serial info  */
  23.                   long (*xpr_ffirst)();     /* Find first file name     */
  24.                   long (*xpr_fnext)();      /* Find next file name      */
  25.                   long (*xpr_finfo)();      /* Return file info         */
  26.                   long (*xpr_fseek)();      /* Seek in a file           */
  27.                   long   xpr_extension;     /* Number of extensions     */
  28.                   long  *xpr_data;          /* Initialized by Setup.    */
  29.                   long (*xpr_options)();    /* Multiple XPR options.    */
  30.                   long (*xpr_unlink)();     /* Delete a file.           */
  31.                   long (*xpr_squery)();     /* Query serial device      */
  32.                   long (*xpr_getptr)();     /* Get various host ptrs    */
  33.               };
  34. /*
  35. *   Number of defined extensions
  36. */
  37. #define XPR_EXTENSION 4L
  38. #define BUFFER_NUMBER 2
  39.  
  40. /*
  41. *   The functions
  42. */
  43.  
  44. LONG XProtocolCleanup(struct XPR_IO *);
  45. LONG XProtocolSetup(struct XPR_IO *);
  46. LONG XProtocolSend(struct XPR_IO *);
  47. LONG XProtocolReceive(struct XPR_IO *);
  48.  
  49. #ifdef LATTICE
  50.  
  51. /* Pragmas for SAS/Lattice-C V5.0 */
  52.  
  53. #pragma libcall XProtocolBase XProtocolCleanup 1e 801
  54. #pragma libcall XProtocolBase XProtocolSetup 24 801
  55. #pragma libcall XProtocolBase XProtocolSend 2a 801
  56. #pragma libcall XProtocolBase XProtocolReceive 30 801
  57. #pragma libcall XProtocolBase XProtocolHostMon 36 109804
  58. #pragma libcall XProtocolBase XProtocolUserMon 3c 109804
  59.  
  60. #endif    /* LATTICE */
  61.  
  62. #ifdef AZTEC_C
  63.  
  64. /* Pragmas for Manx Aztec-C V5.0 */
  65.  
  66. #pragma amicall(XProtocolBase, 0x1e, XProtocolCleanup(a0))
  67. #pragma amicall(XProtocolBase, 0x24, XProtocolSetup(a0))
  68. #pragma amicall(XProtocolBase, 0x2a, XProtocolSend(a0))
  69. #pragma amicall(XProtocolBase, 0x30, XProtocolReceive(a0))
  70. #pragma amicall(XProtocolBase, 0x36, XProtocolHostMon(a0,a1,d0,d1))
  71. #pragma amicall(XProtocolBase, 0x3c, XProtocolUserMon(a0,a1,d0,d1))
  72.  
  73. #endif    /* AZTEC */
  74.  
  75. /*
  76. *   Flags returned by XProtocolSetup()
  77. */
  78. #define XPRS_FAILURE    0x00000000L
  79. #define XPRS_SUCCESS    0x00000001L
  80. #define XPRS_NORECREQ   0x00000002L
  81. #define XPRS_NOSNDREQ   0x00000004L
  82. #define XPRS_HOSTMON    0x00000008L
  83. #define XPRS_USERMON    0x00000010L
  84. #define XPRS_HOSTNOWAIT 0x00000020L
  85. /*
  86. *   The update structure
  87. */
  88. struct XPR_UPDATE {     long  xpru_updatemask;
  89.                         UBYTE *xpru_protocol;
  90.                         UBYTE *xpru_filename;
  91.                         long  xpru_filesize;
  92.                         UBYTE *xpru_msg;
  93.                         UBYTE *xpru_errormsg;
  94.                         long  xpru_blocks;
  95.                         long  xpru_blocksize;
  96.                         long  xpru_bytes;
  97.                         long  xpru_errors;
  98.                         long  xpru_timeouts;
  99.                         long  xpru_packettype;
  100.                         long  xpru_packetdelay;
  101.                         long  xpru_chardelay;
  102.                         UBYTE *xpru_blockcheck;
  103.                         UBYTE *xpru_expecttime;
  104.                         UBYTE *xpru_elapsedtime;
  105.                         long  xpru_datarate;
  106.                         long  xpru_reserved1;
  107.                         long  xpru_reserved2;
  108.                         long  xpru_reserved3;
  109.                         long  xpru_reserved4;
  110.                         long  xpru_reserved5;
  111.                    };
  112. /*
  113. *   The possible bit values for the xpru_updatemask are:
  114. */
  115. #define XPRU_PROTOCOL           0x00000001L
  116. #define XPRU_FILENAME           0x00000002L
  117. #define XPRU_FILESIZE           0x00000004L
  118. #define XPRU_MSG                0x00000008L
  119. #define XPRU_ERRORMSG           0x00000010L
  120. #define XPRU_BLOCKS             0x00000020L
  121. #define XPRU_BLOCKSIZE          0x00000040L
  122. #define XPRU_BYTES              0x00000080L
  123. #define XPRU_ERRORS             0x00000100L
  124. #define XPRU_TIMEOUTS           0x00000200L
  125. #define XPRU_PACKETTYPE         0x00000400L
  126. #define XPRU_PACKETDELAY        0x00000800L
  127. #define XPRU_CHARDELAY          0x00001000L
  128. #define XPRU_BLOCKCHECK         0x00002000L
  129. #define XPRU_EXPECTTIME         0x00004000L
  130. #define XPRU_ELAPSEDTIME        0x00008000L
  131. #define XPRU_DATARATE           0x00010000L
  132. /*
  133. *   The xpro_option structure
  134. */
  135. struct xpr_option {
  136.    UBYTE *xpro_description;      /* description of the option                  */
  137.    long  xpro_type;             /* type of option                             */
  138.    UBYTE *xpro_value;            /* pointer to a buffer with the current value */
  139.    long  xpro_length;           /* buffer size                                */
  140. };
  141. /*
  142. *   Valid values for xpro_type are:
  143. */
  144. #define XPRO_BOOLEAN 1L         /* xpro_value is "yes", "no", "on" or "off"   */
  145. #define XPRO_LONG    2L         /* xpro_value is string representing a number */
  146. #define XPRO_STRING  3L         /* xpro_value is a string                     */
  147. #define XPRO_HEADER  4L         /* xpro_value is ignored                      */
  148. #define XPRO_COMMAND 5L         /* xpro_value is ignored                      */
  149. #define XPRO_COMMPAR 6L         /* xpro_value contains command parameters     */
  150.  
  151. struct Buffer
  152. {
  153.     struct Message             Message;            /* Vanilla message header. */
  154.  
  155.     BYTE                 Read;                /* Last access has read data. */
  156.     BYTE                 Written;            /* Last access has written data. */
  157.  
  158.     LONG                 Action;            /* Action to perform. */
  159.     LONG                 ActionData[2];            /* Seek and the like. */
  160.     LONG                 Result;            /* Return value. */
  161.  
  162.     BPTR                 FileHandle;            /* Dos filehandle. */
  163.  
  164.     UBYTE                *Data;                /* Data buffer. */
  165.     LONG                 BufLength;            /* Length of data buffer. */
  166.  
  167.     LONG                 BufPosition;            /* Read/write pointer into buffer. */
  168.  
  169.     LONG                 ReadBufFull;            /* How many bytes are still to be read from the buffer? */
  170.     LONG                 WriteBufFull;            /* How many bytes are still to be written to the buffer?*/
  171.  
  172.     LONG                 RealPosition;            /* Real position in file. */
  173.     LONG                 Cached;            /* How many bytes in pre-load cache. */
  174.  
  175.     UBYTE                *DataBuffer[BUFFER_NUMBER];    /* The data buffers. */
  176.     LONG                 DataLength[BUFFER_NUMBER];    /* The lengths of the data buffers. */
  177.     WORD                 DataCount;            /* Which buffer to use. */
  178.     BYTE                 WriteAccess;            /* TRUE if a write file handle. */
  179.     BYTE                 LastActionFailed;        /* TRUE if last action failed -> abort actions. */
  180.  
  181.     struct Process            *Child;
  182.     struct Process            *Caller;            /* Synchronization. */
  183.  
  184.     BPTR                 DirLock;
  185.     struct InfoData __aligned     InfoData;
  186.  
  187.     BYTE                 Fresh;                /* TRUE if no read/write access has taken place yet. */
  188. };
  189. #define BYTES_FULL_TXT 751
  190. #define BYTES_FULL_TXT_STR "%10ld bytes (%ld%% full)"
  191.  
  192. #define FILE_MAY_NOT_FIT_TXT 749
  193. #define FILE_MAY_NOT_FIT_TXT_STR ", FILE MAY NOT FIT"
  194.  
  195.     /* xpr serial bits. */
  196.  
  197. #define ST_PARTYON    (1 << 0)
  198. #define ST_PARTYODD    (1 << 1)
  199. #define ST_7WIRE    (1 << 2)
  200. #define ST_QBREAK    (1 << 3)
  201. #define ST_RADBOOGIE    (1 << 4)
  202. #define ST_SHARED    (1 << 5)
  203. #define ST_EOFMODE    (1 << 6)
  204. #define ST_XDISABLED    (1 << 7)
  205. #define ST_PARTYMARKON    (1 << 8)
  206. #define ST_PARTYMARK    (1 << 9)
  207. #define ST_2BITS    (1 << 10)
  208. #define ST_READ7    (1 << 11)
  209. #define ST_WRITE7    (1 << 12)
  210.